diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/packages/ticker/src/TickerListener.js b/packages/ticker/src/TickerListener.js index 2874b81..2bdb362 100644 --- a/packages/ticker/src/TickerListener.js +++ b/packages/ticker/src/TickerListener.js @@ -9,7 +9,7 @@ { /** * Constructor - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} [context=null] - The listener context * @param {number} [priority=0] - The priority for emitting @@ -19,36 +19,42 @@ { /** * The handler function to execute. + * @private * @member {Function} */ this.fn = fn; /** * The calling to execute. + * @private * @member {Function} */ this.context = context; /** * The current priority. + * @private * @member {number} */ this.priority = priority; /** * If this should only execute once. + * @private * @member {boolean} */ this.once = once; /** * The next item in chain. + * @private * @member {TickerListener} */ this.next = null; /** * The previous item in chain. + * @private * @member {TickerListener} */ this.previous = null; @@ -63,7 +69,7 @@ /** * Simple compare function to figure out if a function and context match. - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} context - The listener context * @return {boolean} `true` if the listener match the arguments @@ -77,6 +83,7 @@ /** * Emit by calling the current function. + * @private * @param {number} deltaTime - time since the last emit. * @return {TickerListener} Next ticker */ @@ -113,6 +120,7 @@ /** * Connect to the list. + * @private * @param {TickerListener} previous - Input node, previous listener */ connect(previous) @@ -128,6 +136,7 @@ /** * Destroy and don't use after this. + * @private * @param {boolean} [hard = false] `true` to remove the `next` reference, this * is considered a hard destroy. Soft destroy maintains the next reference. * @return {TickerListener} The listener to redirect while emitting or removing. diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/packages/ticker/src/TickerListener.js b/packages/ticker/src/TickerListener.js index 2874b81..2bdb362 100644 --- a/packages/ticker/src/TickerListener.js +++ b/packages/ticker/src/TickerListener.js @@ -9,7 +9,7 @@ { /** * Constructor - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} [context=null] - The listener context * @param {number} [priority=0] - The priority for emitting @@ -19,36 +19,42 @@ { /** * The handler function to execute. + * @private * @member {Function} */ this.fn = fn; /** * The calling to execute. + * @private * @member {Function} */ this.context = context; /** * The current priority. + * @private * @member {number} */ this.priority = priority; /** * If this should only execute once. + * @private * @member {boolean} */ this.once = once; /** * The next item in chain. + * @private * @member {TickerListener} */ this.next = null; /** * The previous item in chain. + * @private * @member {TickerListener} */ this.previous = null; @@ -63,7 +69,7 @@ /** * Simple compare function to figure out if a function and context match. - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} context - The listener context * @return {boolean} `true` if the listener match the arguments @@ -77,6 +83,7 @@ /** * Emit by calling the current function. + * @private * @param {number} deltaTime - time since the last emit. * @return {TickerListener} Next ticker */ @@ -113,6 +120,7 @@ /** * Connect to the list. + * @private * @param {TickerListener} previous - Input node, previous listener */ connect(previous) @@ -128,6 +136,7 @@ /** * Destroy and don't use after this. + * @private * @param {boolean} [hard = false] `true` to remove the `next` reference, this * is considered a hard destroy. Soft destroy maintains the next reference. * @return {TickerListener} The listener to redirect while emitting or removing. diff --git a/packages/utils/src/const.js b/packages/utils/src/const.js index cf431a8..5895fe1 100644 --- a/packages/utils/src/const.js +++ b/packages/utils/src/const.js @@ -3,10 +3,8 @@ * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static - * @constant - * @name DATA_URI + * @constant {RegExp|string} DATA_URI * @memberof PIXI - * @type {RegExp|string} * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/packages/ticker/src/TickerListener.js b/packages/ticker/src/TickerListener.js index 2874b81..2bdb362 100644 --- a/packages/ticker/src/TickerListener.js +++ b/packages/ticker/src/TickerListener.js @@ -9,7 +9,7 @@ { /** * Constructor - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} [context=null] - The listener context * @param {number} [priority=0] - The priority for emitting @@ -19,36 +19,42 @@ { /** * The handler function to execute. + * @private * @member {Function} */ this.fn = fn; /** * The calling to execute. + * @private * @member {Function} */ this.context = context; /** * The current priority. + * @private * @member {number} */ this.priority = priority; /** * If this should only execute once. + * @private * @member {boolean} */ this.once = once; /** * The next item in chain. + * @private * @member {TickerListener} */ this.next = null; /** * The previous item in chain. + * @private * @member {TickerListener} */ this.previous = null; @@ -63,7 +69,7 @@ /** * Simple compare function to figure out if a function and context match. - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} context - The listener context * @return {boolean} `true` if the listener match the arguments @@ -77,6 +83,7 @@ /** * Emit by calling the current function. + * @private * @param {number} deltaTime - time since the last emit. * @return {TickerListener} Next ticker */ @@ -113,6 +120,7 @@ /** * Connect to the list. + * @private * @param {TickerListener} previous - Input node, previous listener */ connect(previous) @@ -128,6 +136,7 @@ /** * Destroy and don't use after this. + * @private * @param {boolean} [hard = false] `true` to remove the `next` reference, this * is considered a hard destroy. Soft destroy maintains the next reference. * @return {TickerListener} The listener to redirect while emitting or removing. diff --git a/packages/utils/src/const.js b/packages/utils/src/const.js index cf431a8..5895fe1 100644 --- a/packages/utils/src/const.js +++ b/packages/utils/src/const.js @@ -3,10 +3,8 @@ * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static - * @constant - * @name DATA_URI + * @constant {RegExp|string} DATA_URI * @memberof PIXI - * @type {RegExp|string} * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; diff --git a/packages/utils/src/media/caches.js b/packages/utils/src/media/caches.js index 7ef46ae..6185065 100644 --- a/packages/utils/src/media/caches.js +++ b/packages/utils/src/media/caches.js @@ -1,24 +1,30 @@ /** * @todo Describe property usage * + * @static + * @name ProgramCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const ProgramCache = {}; /** * @todo Describe property usage * + * @static + * @name TextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const TextureCache = Object.create(null); /** * @todo Describe property usage * + * @static + * @name BaseTextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const BaseTextureCache = Object.create(null); diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/packages/ticker/src/TickerListener.js b/packages/ticker/src/TickerListener.js index 2874b81..2bdb362 100644 --- a/packages/ticker/src/TickerListener.js +++ b/packages/ticker/src/TickerListener.js @@ -9,7 +9,7 @@ { /** * Constructor - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} [context=null] - The listener context * @param {number} [priority=0] - The priority for emitting @@ -19,36 +19,42 @@ { /** * The handler function to execute. + * @private * @member {Function} */ this.fn = fn; /** * The calling to execute. + * @private * @member {Function} */ this.context = context; /** * The current priority. + * @private * @member {number} */ this.priority = priority; /** * If this should only execute once. + * @private * @member {boolean} */ this.once = once; /** * The next item in chain. + * @private * @member {TickerListener} */ this.next = null; /** * The previous item in chain. + * @private * @member {TickerListener} */ this.previous = null; @@ -63,7 +69,7 @@ /** * Simple compare function to figure out if a function and context match. - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} context - The listener context * @return {boolean} `true` if the listener match the arguments @@ -77,6 +83,7 @@ /** * Emit by calling the current function. + * @private * @param {number} deltaTime - time since the last emit. * @return {TickerListener} Next ticker */ @@ -113,6 +120,7 @@ /** * Connect to the list. + * @private * @param {TickerListener} previous - Input node, previous listener */ connect(previous) @@ -128,6 +136,7 @@ /** * Destroy and don't use after this. + * @private * @param {boolean} [hard = false] `true` to remove the `next` reference, this * is considered a hard destroy. Soft destroy maintains the next reference. * @return {TickerListener} The listener to redirect while emitting or removing. diff --git a/packages/utils/src/const.js b/packages/utils/src/const.js index cf431a8..5895fe1 100644 --- a/packages/utils/src/const.js +++ b/packages/utils/src/const.js @@ -3,10 +3,8 @@ * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static - * @constant - * @name DATA_URI + * @constant {RegExp|string} DATA_URI * @memberof PIXI - * @type {RegExp|string} * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; diff --git a/packages/utils/src/media/caches.js b/packages/utils/src/media/caches.js index 7ef46ae..6185065 100644 --- a/packages/utils/src/media/caches.js +++ b/packages/utils/src/media/caches.js @@ -1,24 +1,30 @@ /** * @todo Describe property usage * + * @static + * @name ProgramCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const ProgramCache = {}; /** * @todo Describe property usage * + * @static + * @name TextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const TextureCache = Object.create(null); /** * @todo Describe property usage * + * @static + * @name BaseTextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const BaseTextureCache = Object.create(null); diff --git a/packages/utils/src/media/trimCanvas.js b/packages/utils/src/media/trimCanvas.js index 1fddcf6..5549664 100644 --- a/packages/utils/src/media/trimCanvas.js +++ b/packages/utils/src/media/trimCanvas.js @@ -1,9 +1,8 @@ /** * Trim transparent borders from a canvas * - * @memberof PIXI + * @memberof PIXI.utils * @function trimCanvas - * @private * @param {HTMLCanvasElement} canvas - the canvas to trim * @returns {object} Trim data */ diff --git a/bundles/pixi.js/src/deprecated.js b/bundles/pixi.js/src/deprecated.js index f7ea0ad..ad04323 100644 --- a/bundles/pixi.js/src/deprecated.js +++ b/bundles/pixi.js/src/deprecated.js @@ -6,10 +6,9 @@ { Object.defineProperties(PIXI, { /** - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI - * @see PIXI.SVGResource.SVG_SIZE + * @see PIXI.resources.SVGResource.SVG_SIZE * @deprecated since 5.0.0 */ SVG_SIZE: { @@ -56,7 +55,7 @@ * @constant * @name TRANSFORM_MODE * @memberof PIXI - * @type {object} + * @enum {number} * @deprecated since 5.0.0 * @property {number} STATIC * @property {number} DYNAMIC @@ -195,7 +194,7 @@ Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize - * @see PIXI.SVGResource.getSize + * @see PIXI.resources.SVGResource.getSize * @deprecated since 5.0.0 */ getSvgSize: { @@ -309,7 +308,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.particles @@ -346,7 +345,7 @@ }, }); - /* + /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. * @namespace PIXI.ticker @@ -488,7 +487,7 @@ /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Prepare + * @see PIXI.extract.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get() diff --git a/bundles/pixi.js/src/index.js b/bundles/pixi.js/src/index.js index a46a3d9..9e80f0d 100644 --- a/bundles/pixi.js/src/index.js +++ b/bundles/pixi.js/src/index.js @@ -45,7 +45,7 @@ loaders.Loader.registerPlugin(spritesheet.SpritesheetLoader); app.Application.registerPlugin(ticker.TickerPlugin); -app.Application.registerPlugin(loaders.LoaderPlugin); +app.Application.registerPlugin(loaders.AppLoaderPlugin); // Apply deplayed mixins utils.mixins.performMixins(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index cd19d5d..cadb269 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -105,18 +105,31 @@ /** * pre-bind the functions * + * @type {Function} * @private */ this._onKeyDown = this._onKeyDown.bind(this); + + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ this._onMouseMove = this._onMouseMove.bind(this); /** - * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. - * - * @member {Array<*>} - * @private + * A flag + * @type {boolean} + * @readonly */ this.isActive = false; + + /** + * A flag + * @type {boolean} + * @readonly + */ this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer diff --git a/packages/accessibility/src/accessibleTarget.js b/packages/accessibility/src/accessibleTarget.js index 4cda116..37ec047 100644 --- a/packages/accessibility/src/accessibleTarget.js +++ b/packages/accessibility/src/accessibleTarget.js @@ -2,8 +2,10 @@ * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. * + * @private * @function accessibleTarget * @memberof PIXI.accessibility + * @type {Object} * @example * function MyObject() {} * @@ -18,6 +20,7 @@ * shadow div with attributes set * * @member {boolean} + * @memberof PIXI.DisplayObject# */ accessible: false, @@ -25,7 +28,8 @@ * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' * - * @member {string} + * @member {?string} + * @memberof PIXI.DisplayObject# */ accessibleTitle: null, @@ -33,20 +37,28 @@ * Sets the aria-label attribute of the shadow div * * @member {string} + * @memberof PIXI.DisplayObject# */ accessibleHint: null, /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private * @todo Needs docs. */ tabIndex: 0, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, /** + * @member {boolean} + * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleDiv: false, diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 149c20b..035918d 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -91,7 +91,7 @@ /** * Register a middleware plugin for the application * @static - * @param {PIXI.Application~Plugin} plugin - Plugin being installed + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ static registerPlugin(plugin) { @@ -172,7 +172,8 @@ } /** - * @typedef {object} PIXI.Application~Plugin + * @memberof PIXI.Application + * @typedef {object} Plugin * @property {function} init - Called when Application is constructed, scoped to Application instance. * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance @@ -182,6 +183,6 @@ * Collection of installed plugins. * @static * @private - * @type {PIXI.Application~Plugin[]} + * @type {PIXI.Application.Plugin[]} */ Application._plugins = []; diff --git a/packages/canvas/canvas-display/src/Container.js b/packages/canvas/canvas-display/src/Container.js index 4dc50a9..30fbc2b 100644 --- a/packages/canvas/canvas-display/src/Container.js +++ b/packages/canvas/canvas-display/src/Container.js @@ -2,8 +2,9 @@ /** * To be overridden by the subclass - * - * @private + * @method _renderCanvas + * @memberof PIXI.Container# + * @protected * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars @@ -13,7 +14,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ Container.prototype.renderCanvas = function renderCanvas(renderer) diff --git a/packages/canvas/canvas-display/src/DisplayObject.js b/packages/canvas/canvas-display/src/DisplayObject.js index 91b6ed8..87df2ce 100644 --- a/packages/canvas/canvas-display/src/DisplayObject.js +++ b/packages/canvas/canvas-display/src/DisplayObject.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.Container# * @param {PIXI.CanvasRenderer} renderer - The renderer */ DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js index 15ee89b..33c7bce 100644 --- a/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js +++ b/packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.js @@ -16,7 +16,7 @@ * Renderer dedicated to drawing and batching graphics objects. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasGraphicsRenderer @@ -220,7 +220,7 @@ /** * Updates the tint of a graphics object * - * @private + * @protected * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated */ updateGraphicsTint(graphics) diff --git a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js index 887d93c..56440f0 100644 --- a/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js +++ b/packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js @@ -4,7 +4,7 @@ * Renderer dedicated to meshes. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasMeshRenderer diff --git a/packages/canvas/canvas-mesh/src/MeshMaterial.js b/packages/canvas/canvas-mesh/src/MeshMaterial.js index 6ed79f2..5cf82ef 100644 --- a/packages/canvas/canvas-mesh/src/MeshMaterial.js +++ b/packages/canvas/canvas-mesh/src/MeshMaterial.js @@ -3,7 +3,7 @@ /** * Renders the mesh using the Canvas renderer * - * @private + * @protected * @method render * @memberof PIXI.MeshMaterial# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-mesh/src/NineSlicePlane.js b/packages/canvas/canvas-mesh/src/NineSlicePlane.js index 040cf3a..f75e44f 100644 --- a/packages/canvas/canvas-mesh/src/NineSlicePlane.js +++ b/packages/canvas/canvas-mesh/src/NineSlicePlane.js @@ -65,7 +65,7 @@ * @method drawSegment * @memberof PIXI.NineSlicePlane# * @param {CanvasRenderingContext2D} context - The context to draw with. - * @param {CanvasImageSource} textureSource - The source to draw. + * @param {ICanvasImageSource} textureSource - The source to draw. * @param {number} w - width of the texture * @param {number} h - height of the texture * @param {number} x1 - x index 1 diff --git a/packages/canvas/canvas-mesh/src/SimpleRope.js b/packages/canvas/canvas-mesh/src/SimpleRope.js index 7854486..f8aced6 100644 --- a/packages/canvas/canvas-mesh/src/SimpleRope.js +++ b/packages/canvas/canvas-mesh/src/SimpleRope.js @@ -3,7 +3,7 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected * @method _renderCanvas * @memberof PIXI.Mesh# * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. diff --git a/packages/canvas/canvas-particles/src/ParticleContainer.js b/packages/canvas/canvas-particles/src/ParticleContainer.js index 3eb417f..3a9d755 100644 --- a/packages/canvas/canvas-particles/src/ParticleContainer.js +++ b/packages/canvas/canvas-particles/src/ParticleContainer.js @@ -2,7 +2,8 @@ /** * Renders the object using the Canvas renderer - * + * @method renderCanvas + * @memberof PIXI.ParticleContainer# * @private * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ diff --git a/packages/canvas/canvas-renderer/src/BaseTexture.js b/packages/canvas/canvas-renderer/src/BaseTexture.js index d0310d0..13b461a 100644 --- a/packages/canvas/canvas-renderer/src/BaseTexture.js +++ b/packages/canvas/canvas-renderer/src/BaseTexture.js @@ -5,7 +5,7 @@ * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. * @method getDrawableSource * @memberof PIXI.BaseTexture# - * @return {CanvasImageSource} Source to render with CanvasRenderer + * @return {ICanvasImageSource} Source to render with CanvasRenderer */ BaseTexture.prototype.getDrawableSource = function getDrawableSource() { diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 50dae92..40f1ed8 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -98,6 +98,11 @@ this.initPlugins(CanvasRenderer.__plugins); + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ this.blendModes = mapCanvasBlendModesToPixi(); this._activeBlendMode = null; diff --git a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js index c4f34be..b940a91 100644 --- a/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js +++ b/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js @@ -23,6 +23,7 @@ /** * Checks whether the Canvas BlendModes are supported by the current browser * + * @private * @return {boolean} whether they are supported */ export default function canUseNewCanvasBlendModes() diff --git a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js index dbeff77..8db6ed9 100644 --- a/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js +++ b/packages/canvas/canvas-sprite-tiling/src/TilingSprite.js @@ -5,7 +5,9 @@ /** * Renders the object using the Canvas renderer * - * @private + * @protected + * @function _renderCanvas + * @memberof PIXI.TilingSprite# * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer */ TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) diff --git a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js index bb2808a..09fde6d 100644 --- a/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js +++ b/packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.js @@ -5,6 +5,11 @@ const canvasRenderWorldTransform = new Matrix(); /** + * Types that can be passed to drawImage + * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource + */ + +/** * @author Mat Groves * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ @@ -20,7 +25,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI */ export default class CanvasSpriteRenderer diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 4c8f189..5b30162 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -274,21 +274,14 @@ * The tinting method that will be used. * * @memberof PIXI.CanvasTinter - * @type {tintMethodFunctionType} + * @type {Function} */ - tintMethod: 0, + tintMethod: () => + { // jslint-disable no-empty-function + + }, }; CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -/** - * The tintMethod type. - * - * @memberof PIXI.CanvasTinter - * @callback tintMethodFunctionType - * @param texture {PIXI.Texture} the texture to tint - * @param color {number} the color to use to tint the sprite with - * @param canvas {HTMLCanvasElement} the current canvas - */ - export default CanvasTinter; diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 971ef53..4144b38 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -2,10 +2,9 @@ * Different types of environments for WebGL. * * @static - * @constant * @memberof PIXI * @name ENV - * @type {object} + * @enum {number} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL @@ -21,10 +20,9 @@ * Constant to identify the Renderer Type. * * @static - * @constant * @memberof PIXI * @name RENDERER_TYPE - * @type {object} + * @enum {number} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. * @property {number} CANVAS - Canvas render type. @@ -41,11 +39,9 @@ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. * Anything else will silently act like NORMAL. * - * @static - * @constant * @memberof PIXI * @name BLEND_MODES - * @type {object} + * @enum {number} * @property {number} NORMAL * @property {number} ADD * @property {number} MULTIPLY @@ -91,11 +87,10 @@ * Various webgl draw modes. These can be used to specify which GL drawMode to use * under certain situations and renderers. * - * @static - * @constant * @memberof PIXI + * @static * @name DRAW_MODES - * @type {object} + * @enum {number} * @property {number} POINTS * @property {number} LINES * @property {number} LINE_LOOP @@ -117,11 +112,10 @@ /** * Various GL texture/resources formats. * - * @static - * @constant * @memberof PIXI + * @static * @name FORMATS - * @type {object} + * @enum {number} * @property {number} RGBA=6408 * @property {number} RGB=6407 * @property {number} ALPHA=6406 @@ -143,11 +137,10 @@ /** * Various GL target types. * - * @static - * @constant * @memberof PIXI + * @static * @name TARGETS - * @type {object} + * @enum {number} * @property {number} TEXTURE_2D=3553 * @property {number} TEXTURE_CUBE_MAP=34067 * @property {number} TEXTURE_2D_ARRAY=35866 @@ -173,11 +166,10 @@ /** * Various GL data format types. * - * @static - * @constant * @memberof PIXI + * @static * @name TYPES - * @type {object} + * @enum {number} * @property {number} UNSIGNED_BYTE=5121 * @property {number} UNSIGNED_SHORT=5123 * @property {number} UNSIGNED_SHORT_5_6_5=33635 @@ -202,11 +194,10 @@ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * - * @static - * @constant * @memberof PIXI + * @static * @name SCALE_MODES - * @type {object} + * @enum {number} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling */ @@ -225,11 +216,10 @@ * * This property only affects WebGL. * - * @static - * @constant * @name WRAP_MODES * @memberof PIXI - * @type {object} + * @static + * @enum {number} * @property {number} CLAMP - The textures uvs are clamped * @property {number} REPEAT - The texture uvs tile and repeat * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring @@ -252,11 +242,10 @@ * Handy for mobile devices! * This property only affects WebGL. * - * @static - * @constant * @name GC_MODES + * @enum {number} + * @static * @memberof PIXI - * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically * @property {number} MANUAL - Garbage collection will need to be called manually */ @@ -268,11 +257,11 @@ /** * Constants that specify float precision in shaders. * - * @static - * @constant * @name PRECISION * @memberof PIXI - * @type {object} + * @static + * @enum {string} + * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index cd34f2e..b814140 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -14,7 +14,7 @@ * * @abstract * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class AbstractRenderer extends EventEmitter @@ -119,13 +119,6 @@ // autoResize is deprecated, provides fallback support /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - this.blendModes = null; - - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * @@ -149,7 +142,7 @@ * The background color as a number. * * @member {number} - * @private + * @protected */ this._backgroundColor = 0x000000; @@ -157,7 +150,7 @@ * The background color as an [R, G, B] array. * * @member {number[]} - * @private + * @protected */ this._backgroundColorRgba = [0, 0, 0, 0]; @@ -165,7 +158,7 @@ * The background color as a string. * * @member {string} - * @private + * @protected */ this._backgroundColorString = '#000000'; @@ -175,7 +168,7 @@ * This temporary display object used as the parent of the currently being rendered item. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._tempDisplayObjectParent = new Container(); @@ -183,7 +176,7 @@ * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} - * @private + * @protected */ this._lastObjectRendered = this._tempDisplayObjectParent; diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index 1bc7f49..a668120 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -55,6 +55,7 @@ * (shown if not transparent). * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" * for devices with dual graphics card. + * @param {object} [options.context] If WebGL context already exists, all parameters must be taken from it. */ constructor(options = {}, arg2, arg3) { @@ -82,6 +83,7 @@ * are assigned to each system created. * @see https://github.com/GoodBoyDigital/mini-runner * @name PIXI.Renderer#runners + * @private * @type {object} * @readonly * @property {Runner} destroy - Destroy runner @@ -206,9 +208,6 @@ /** * The options passed in to create a new WebGL context. - * - * @member {object} - * @private */ if (options.context) { @@ -241,7 +240,7 @@ /** * Add a new system to the renderer. - * @param {class} ClassRef - Class reference + * @param {Function} ClassRef - Class reference * @param {string} [name] - Property name for system, if not specified * will use a static `name` property on the class itself. This * name will be assigned as s property on the Renderer so make @@ -412,9 +411,9 @@ * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.extract.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. */ /** diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 0fb494c..2b98310 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -23,9 +23,9 @@ /** * Generic method called when there is a WebGL context change. - * @param {WebGLRenderingContext} gl - WebGL context + * @param {WebGLRenderingContext} gl new webgl context */ - contextChange() + contextChange(gl) // eslint-disable-line no-unused-vars { // do some codes init! } diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 2ae4a46..52f028a 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -20,14 +20,14 @@ /** * Buffer used for position, color, texture IDs * @member {PIXI.Buffer} - * @private + * @protected */ this._buffer = new Buffer(null, _static, false); /** * Index buffer data * @member {PIXI.Buffer} - * @private + * @protected */ this._indexBuffer = new Buffer(null, _static, true); diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index 8c07212..c6d7bd0 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -18,7 +18,7 @@ * Renderer dedicated to drawing and batching sprites. * * @class - * @private + * @protected * @memberof PIXI * @extends PIXI.ObjectRenderer */ @@ -105,8 +105,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index 202d6eb..bd6065b 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -30,7 +30,7 @@ * @member {object} * @readonly * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBKIT_WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension * @property {OES_texture_float} floatTexture - WebGL v1 extension * @property {WEBGL_lose_context} loseContext - WebGL v1 extension * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension @@ -57,6 +57,7 @@ /** * Handle the context change event + * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) { @@ -72,7 +73,7 @@ /** * Initialize the context * - * @private + * @protected * @param {WebGLRenderingContext} gl - WebGL context */ initFromContext(gl) @@ -87,7 +88,7 @@ /** * Initialize from context options * - * @private + * @protected * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ @@ -143,7 +144,7 @@ /** * Auto-populate the extensions * - * @private + * @protected */ getExtensions() { @@ -169,7 +170,7 @@ /** * Handles a lost webgl context * - * @private + * @protected * @param {WebGLContextEvent} event - The context lost event. */ handleContextLost(event) @@ -180,7 +181,7 @@ /** * Handles a restored webgl context * - * @private + * @protected */ handleContextRestored() { @@ -206,7 +207,7 @@ /** * Handle the post-render runner event * - * @private + * @protected */ postrender() { @@ -216,7 +217,7 @@ /** * Validate context * - * @private + * @protected * @param {WebGLRenderingContext} gl - Render context */ validateContext(gl) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 6742fe8..3a89a95 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -12,7 +12,7 @@ * * ### Usage * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * renders the container into temporary FrameBuffer, then filter + * renders the container into temporary Framebuffer, then filter * renders it to the screen. Multiple filters can be added to the `filters` property * and stacked on each other. * @@ -30,7 +30,7 @@ * had to create a set of uniforms to deal with coordinates. * * In PixiJS **v5** combines _both approaches_, developers can use normal coordinates of - * v3 and then allow filter to use partial FrameBuffers, bringing those extra + * v3 and then allow filter to use partial Framebuffers, bringing those extra * uniforms into account. * * ### Built-in Uniforms @@ -41,10 +41,10 @@ * **uSampler** * * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all PixiJS' FrameBuffers, both input and output are + * _Important note: as with all PixiJS' Framebuffers, both input and output are * premultiplied by alpha._ * - * By default, input FrameBuffer space coordinates are passed to fragment shader with `vTextureCoord`. + * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. * Use it to sample the input. * * ``` @@ -66,7 +66,7 @@ * * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary FrameBuffer is used, + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, * `(0, 0, outputFrame.width, outputFrame.height)`, * * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. @@ -82,15 +82,15 @@ * * **inputSize** * - * Temporary FrameBuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary FrameBuffer that holds input. + * Temporary Framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary Framebuffer that holds input. * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. * * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. * - * To calculate input texture coordinate in 0-1 space, you have to map it to FrameBuffer normalized space. - * Multiply by `outputFrame.zw` to get pixel coordinate in part of FrameBuffer. - * Divide by `inputSize.xy` to get FrameBuffer normalized space (input sampler space) + * To calculate input texture coordinate in 0-1 space, you have to map it to Framebuffer normalized space. + * Multiply by `outputFrame.zw` to get pixel coordinate in part of Framebuffer. + * Divide by `inputSize.xy` to get Framebuffer normalized space (input sampler space) * * ``` * vec2 filterTextureCoord( void ) @@ -111,10 +111,10 @@ * * **inputClamp** * - * If you try to get info from outside of used part of FrameBuffer - you'll get undefined behaviour. + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. * For displacements, coordinates has to be clamped. * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of FrameBuffer + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer * `inputClamp.zw` is bottom-right pixel center. * * ``` @@ -201,9 +201,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : @@ -263,7 +263,8 @@ * Used for caching shader IDs * * @static - * @private + * @type {object} + * @protected */ Filter.SOURCE_KEY_MAP = {}; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3de20b3..c59167f 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -71,6 +71,7 @@ /** * clears the state + * @private */ clear() { @@ -99,7 +100,7 @@ /** * List of filters for the FilterSystem - * @member {Array} + * @member {Object[]} * @readonly */ this.defaultFilterStack = [{}]; @@ -112,7 +113,7 @@ /** * a pool for storing filter states, save us creating new ones each tick - * @member {Array} + * @member {Object[]} */ this.statePool = []; @@ -330,8 +331,8 @@ * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. * @param {boolean} clear - Should the output be cleared before rendering to it */ applyFilter(filter, input, output, clear) @@ -434,7 +435,7 @@ * * TODO move to a separate class could be on renderer? * - * @private + * @protected * @param {number} minWidth - The minimum width of the render texture in real pixels. * @param {number} minHeight - The minimum height of the render texture in real pixels. * @param {number} [resolution=1] - The resolution of the render texture. @@ -497,7 +498,7 @@ /** * Frees a render texture back into the pool. * - * @param {PIXI.RenderTarget} renderTexture - The renderTarget to free + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ returnFilterTexture(renderTexture) { diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 0be1480..5becf5d 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -2,12 +2,12 @@ /** * Calculates the mapped matrix - * @param filterArea {Rectangle} The filter area - * @param sprite {Sprite} the target sprite - * @param outputMatrix {Matrix} @alvin + * @param {PIXI.Matrix} outputMatrix matrix that will normalize map filter cords in the filter to screen space + * @param {PIXI.Rectangle} filterArea filter area + * @param {PIXI.Rectangle} textureSize texture size + * @returns {PIXI.Matrix} same as outputMatrix * @private */ -// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 564b0e6..8d3e4be 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -40,9 +40,9 @@ /** * Applies the filter * - * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTarget} input - The input render target. - * @param {PIXI.RenderTarget} output - The target to output to. + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. */ apply(filterManager, input, output) { diff --git a/packages/core/src/framebuffer/FrameBuffer.js b/packages/core/src/framebuffer/FrameBuffer.js deleted file mode 100644 index 5803f13..0000000 --- a/packages/core/src/framebuffer/FrameBuffer.js +++ /dev/null @@ -1,109 +0,0 @@ -import Texture from '../textures/BaseTexture'; -import { FORMATS, TYPES } from '@pixi/constants'; - -/** - * Frame buffer - * @class - * @memberof PIXI - */ -export default class FrameBuffer -{ - constructor(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFrameBuffers = {}; - } - - get colorTexture() - { - return this.colorTextures[0]; - } - - addColorTexture(index, texture) - { - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height });// || new Texture(); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - addDepthTexture(texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new Texture(null, { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: FORMATS.DEPTH_COMPONENT, - type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableDepth() - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - enableStencil() - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - } - - resize(width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) return; - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (let i = 0; i < this.colorTextures.length; i++) - { - this.colorTextures[i].setSize(width, height); - } - - if (this.depthTexture) - { - this.depthTexture.setSize(width, height); - } - } -} diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js new file mode 100644 index 0000000..8613e22 --- /dev/null +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -0,0 +1,109 @@ +import Texture from '../textures/BaseTexture'; +import { FORMATS, TYPES } from '@pixi/constants'; + +/** + * Frame buffer + * @class + * @memberof PIXI + */ +export default class Framebuffer +{ + constructor(width, height) + { + this.width = Math.ceil(width || 100); + this.height = Math.ceil(height || 100); + + this.stencil = false; + this.depth = false; + + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + + this.depthTexture = null; + this.colorTextures = []; + + this.glFramebuffers = {}; + } + + get colorTexture() + { + return this.colorTextures[0]; + } + + addColorTexture(index, texture) + { + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + mipmap: false, + width: this.width, + height: this.height });// || new Texture(); + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + addDepthTexture(texture) + { + /* eslint-disable max-len */ + this.depthTexture = texture || new Texture(null, { scaleMode: 0, + resolution: 1, + width: this.width, + height: this.height, + mipmap: false, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT; + /* eslint-disable max-len */ + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableDepth() + { + this.depth = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + enableStencil() + { + this.stencil = true; + + this.dirtyId++; + this.dirtyFormat++; + + return this; + } + + resize(width, height) + { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) return; + + this.width = width; + this.height = height; + + this.dirtyId++; + this.dirtySize++; + + for (let i = 0; i < this.colorTextures.length; i++) + { + this.colorTextures[i].setSize(width, height); + } + + if (this.depthTexture) + { + this.depthTexture.setSize(width, height); + } + } +} diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index b08e331..d4df6fa 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -13,8 +13,6 @@ { /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -68,7 +66,7 @@ { // TODO caching layer! - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); // make sure all textures are unbound.. @@ -191,7 +189,7 @@ /** * Initialize framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ initFramebuffer(framebuffer) @@ -207,7 +205,7 @@ dirtySize: 0, }; - framebuffer.glFrameBuffers[this.CONTEXT_UID] = fbo; + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; return fbo; } @@ -215,7 +213,7 @@ /** * Resize the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ resizeFramebuffer(framebuffer) @@ -232,14 +230,14 @@ /** * Update the framebuffer * - * @private + * @protected * @param {PIXI.Framebuffer} framebuffer */ updateFramebuffer(framebuffer) { const { gl } = this; - const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID]; + const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; // bind the color texture const colorTextures = framebuffer.colorTextures; diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 07f9acd..653c9e3 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -8,7 +8,7 @@ * @class * @memberof PIXI */ -class Attribute +export default class Attribute { /** * @param {string} buffer the id of the buffer that this attribute will look for @@ -54,5 +54,3 @@ return new Attribute(buffer, size, stride, start, normalized); } } - -module.exports = Attribute; diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 316b75e..926289b 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -65,7 +65,7 @@ * Helper function that creates a buffer based on an array or TypedArray * * @static - * @param {TypedArray| Array} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. * @return {PIXI.Buffer} A new Buffer based on the data provided. */ static from(data) @@ -78,4 +78,3 @@ return new Buffer(data); } } - diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 1913d44..543f294 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -40,7 +40,7 @@ export default class Geometry { /** - * @param {array} [buffers] an array of buffers. optional. + * @param {PIXI.Buffer[]} [buffers] an array of buffers. optional. * @param {object} [attributes] of the geometry, optional structure of the attributes layout */ constructor(buffers = [], attributes = {}) @@ -54,8 +54,8 @@ /** * A map of renderer IDs to webgl VAOs * - * @private - * @type {Array} + * @protected + * @type {Array} */ this.glVertexArrayObjects = {}; @@ -310,7 +310,7 @@ * merges an array of geometries into a new single one * geometry attribute styles must match for this operation to work * - * @param {array|PIXI.Geometry} geometries array of geometries to merge + * @param {PIXI.Geometry[]} geometries array of geometries to merge * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 5c5c75f..c63a5bd 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -37,15 +37,16 @@ this.hasInstance = true; /** - * A cache of currently bound buffer.. + * A cache of currently bound buffer, + * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER + * @member {Object.} + * @readonly */ this.boundBuffers = {}; } /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { @@ -119,7 +120,7 @@ /** * Binds geometry so that is can be drawn. Creating a Vao if required - * @private + * @protected * @param {PIXI.Geometry} geometry instance of geometry to bind * @param {PIXI.Shader} shader instance of shader to bind */ @@ -174,7 +175,7 @@ /** * Update buffers - * @private + * @protected */ updateBuffers() { @@ -222,7 +223,7 @@ /** * Check compability between a geometry and a program - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ @@ -247,7 +248,7 @@ * @param {PIXI.Geometry} geometry to get signature from * @param {PIXI.Program} prgram to test geometry against * @returns {String} Unique signature of the geometry and program - * @private + * @protected */ getSignature(geometry, program) { @@ -269,7 +270,7 @@ /** * Creates a Vao with the same structure as the geometry and stores it on the geometry. - * @private + * @protected * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ @@ -373,7 +374,7 @@ /** * Activate vertex array object * - * @private + * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ @@ -480,7 +481,7 @@ /** * Unbind/reset everything - * @private + * @protected */ unbind() { diff --git a/packages/core/src/geometry/utils/setVertexAttribArrays.js b/packages/core/src/geometry/utils/setVertexAttribArrays.js index 23b6959..3ab1393 100644 --- a/packages/core/src/geometry/utils/setVertexAttribArrays.js +++ b/packages/core/src/geometry/utils/setVertexAttribArrays.js @@ -4,6 +4,7 @@ * @param gl {WebGLRenderingContext} The current WebGL context * @param attribs {*} * @param state {*} + * @private */ export default function setVertexAttribArrays(gl, attribs, state) { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 14eca1e..cc09f43 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -9,9 +9,10 @@ export { default as System } from './System'; export { default as Renderer } from './Renderer'; export { default as AbstractRenderer } from './AbstractRenderer'; -export { default as FrameBuffer } from './framebuffer/FrameBuffer'; +export { default as Framebuffer } from './framebuffer/Framebuffer'; export { default as CubeTexture } from './textures/CubeTexture'; export { default as BaseTexture } from './textures/BaseTexture'; +export { default as GLTexture } from './textures/BaseTexture'; export { default as Texture } from './textures/Texture'; export { default as TextureMatrix } from './textures/TextureMatrix'; export { default as RenderTexture } from './renderTexture/RenderTexture'; @@ -28,6 +29,7 @@ export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; +export { default as GLProgram } from './shader/GLProgram'; export { default as UniformGroup } from './shader/UniformGroup'; export { default as SpriteMaskFilter } from './filters/spriteMask/SpriteMaskFilter'; export { default as Filter } from './filters/Filter'; diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index aef176a..9a88532 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -129,7 +129,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to * @param {PIXI.Sprite} maskData - Sprite to be used as the mask */ pushSpriteMask(target, maskData) diff --git a/packages/core/src/renderTexture/BaseRenderTexture.js b/packages/core/src/renderTexture/BaseRenderTexture.js index 3fe49e9..24f3a6f 100644 --- a/packages/core/src/renderTexture/BaseRenderTexture.js +++ b/packages/core/src/renderTexture/BaseRenderTexture.js @@ -1,5 +1,5 @@ import BaseTexture from '../textures/BaseTexture'; -import FrameBuffer from '../framebuffer/FrameBuffer'; +import Framebuffer from '../framebuffer/Framebuffer'; /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -76,24 +76,16 @@ this.valid = true; /** - * A map of renderer IDs to webgl renderTargets - * - * @private - * @member {object} - */ - // this._glRenderTargets = {}; - - /** * A reference to the canvas render target (we only need one as this can be shared across renderers) * - * @private - * @member {object} + * @protected + * @member {object} */ this._canvasRenderTarget = null; this.clearColor = [0, 0, 0, 0]; - this.frameBuffer = new FrameBuffer(this.width * this.resolution, this.height * this.resolution) + this.frameBuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) .addColorTexture(0, this) .enableStencil(); diff --git a/packages/core/src/renderTexture/RenderTexture.js b/packages/core/src/renderTexture/RenderTexture.js index 5f96755..6354b80 100644 --- a/packages/core/src/renderTexture/RenderTexture.js +++ b/packages/core/src/renderTexture/RenderTexture.js @@ -89,14 +89,14 @@ /** * FilterSystem temporary storage - * @private + * @protected * @member {PIXI.Rectangle} */ this.filterFrame = null; /** * The key for pooled texture of FilterSystem - * @private + * @protected * @member {string} */ this.filterPoolKey = null; diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 413612a..12e38dc 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -27,7 +27,7 @@ // TODO move this property somewhere else! /** * List of masks for the StencilSystem - * @member {Array} + * @member {PIXI.Graphics[]} * @readonly */ this.defaultMaskStack = []; @@ -57,7 +57,6 @@ /** * Bind the current render texture - * @private * @param {PIXI.RenderTexture} renderTexture * @param {PIXI.Rectangle} sourceFrame * @param {PIXI.Rectangle} destinationFrame diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index ab4003f..2766621 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -2,10 +2,15 @@ * Helper class to create a webGL Program * * @class - * @private + * @memberof PIXI */ export default class GLProgram { + /** + * makes new pixi program + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ constructor(program, uniformData) { /** @@ -18,14 +23,14 @@ /** * holds the uniform data which contains uniform locations * and current uniform values used for caching and preventing unneeded GPU commands - * @type {Object} + * @member {Object} */ this.uniformData = uniformData; /** * uniformGroups holds the various upload functions for the shader. Each uniform group * and program have a unique upload function generated. - * @type {Object} + * @member {Object} */ this.uniformGroups = {}; } diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index a0fd6a6..24d2856 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,13 +15,13 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ -class Program +export default class Program { /** * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ constructor(vertexSrc, fragmentSrc, name = 'pixi-shader') { @@ -61,7 +61,7 @@ /** * Extracts the data for a buy creating a small test program * or reading the src directly. - * @private + * @protected * * @param {string} [vertexSrc] - The source of the vertex shader. * @param {string} [fragmentSrc] - The source of the fragment shader. @@ -90,8 +90,8 @@ * returns the attribute data from the program * @private * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {WebGLProgram} [program] - the webgl program + * @param {WebGLRenderingContext} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -175,6 +175,7 @@ * * @static * @constant + * @member {string} */ static get defaultVertexSrc() { @@ -186,6 +187,7 @@ * * @static * @constant + * @member {string} */ static get defaultFragmentSrc() { @@ -216,5 +218,3 @@ return program; } } - -export default Program; diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index a637234..217029f 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -5,7 +5,6 @@ /** * @class * @memberof PIXI - * @extends PIXI.Shader */ class Shader { @@ -78,6 +77,11 @@ this.uniformGroup = null; } + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ get uniforms() { return this.uniformGroup.uniforms; diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index e43685e..cec829c 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -52,7 +52,7 @@ * * @param {PIXI.Shader} shader - the new shader * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. - * @returns {PIXI.glCore.glProgram} the glProgram that belongs to the shader. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ bind(shader, dontSync) { @@ -149,7 +149,7 @@ * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * - * @return {PIXI.glCore.Shader} the glProgram for the currently bound Shader for this context + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ getglProgram() { @@ -166,7 +166,7 @@ * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiny new glProgram! + * @return {PIXI.GLProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index c8148e3..d03ec5d 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -4,23 +4,50 @@ /** * @class * @memberof PIXI - * @extends PIXI.UniformGroup */ class UniformGroup { /** - * @param {PIXI.Program} [program] - The program the shader will use. + * Uniform group holds uniform map and some ID's for work + * * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ constructor(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ this.group = true; // lets generate this when the shader ? this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ this.dirtyId = 0; + + /** + * unique id + * @protected + * @member {number} + */ this.id = UID++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ this.static = !!_static; } diff --git a/packages/core/src/shader/utils/compileProgram.js b/packages/core/src/shader/utils/compileProgram.js index 8c6ccb9..819f04c 100644 --- a/packages/core/src/shader/utils/compileProgram.js +++ b/packages/core/src/shader/utils/compileProgram.js @@ -1,5 +1,6 @@ /** * @method compileProgram + * @private * @memberof PIXI.glCore.shader * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. diff --git a/packages/core/src/shader/utils/defaultValue.js b/packages/core/src/shader/utils/defaultValue.js index 97290bd..09a5d9f 100644 --- a/packages/core/src/shader/utils/defaultValue.js +++ b/packages/core/src/shader/utils/defaultValue.js @@ -3,6 +3,7 @@ * @memberof PIXI.glCore.shader * @param type {String} Type of value * @param size {Number} + * @private */ export default function defaultValue(type, size) { diff --git a/packages/core/src/shader/utils/mapSize.js b/packages/core/src/shader/utils/mapSize.js index b681554..22e80d1 100644 --- a/packages/core/src/shader/utils/mapSize.js +++ b/packages/core/src/shader/utils/mapSize.js @@ -22,6 +22,7 @@ }; /** + * @private * @method mapSize * @memberof PIXI.glCore.shader * @param type {String} diff --git a/packages/core/src/shader/utils/setPrecision.js b/packages/core/src/shader/utils/setPrecision.js index e571e97..a60ccdf 100644 --- a/packages/core/src/shader/utils/setPrecision.js +++ b/packages/core/src/shader/utils/setPrecision.js @@ -1,5 +1,6 @@ /** * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @private * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index a29d215..9c71356 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -49,8 +49,8 @@ * Attribute state * @member {object} * @readonly - * @property {Array} tempAttribState - * @property {Array} attribState + * @property {number[]} tempAttribState + * @property {number[]} attribState */ this.attribState = null; diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 5ca4b0f..654a195 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -136,7 +136,7 @@ * Global unique identifier for this BaseTexture * * @member {string} - * @private + * @protected */ this.uid = uid(); @@ -144,7 +144,7 @@ * TODO: fill in description * * @member {number} - * @private + * @protected */ this.touched = 0; @@ -170,7 +170,7 @@ /** * Used by TextureSystem to only update texture to the GPU when needed. * - * @private + * @protected * @member {number} */ this.dirtyId = 0; @@ -178,7 +178,7 @@ /** * Used by TextureSystem to only update texture style when needed. * - * @private + * @protected * @member {number} */ this.dirtyStyleId = 0; @@ -301,7 +301,6 @@ /** * Changes style options of BaseTexture * - * @param {object} options * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this @@ -512,7 +511,7 @@ * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The new base texture. + * @returns {PIXI.BaseTexture} The new base texture. */ static from(source, options) { @@ -548,7 +547,7 @@ * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 32fd006..60f87e8 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -17,6 +17,7 @@ * @param {object} [options] - Optional options passed to the resources being loaded. * See {@PIXI.resources.autoDetectResource autoDetectResource} for more info * on the options available to each resource. + * @returns {PIXI.CubeTexture} new cube texture */ static from(resources, options) { diff --git a/packages/core/src/textures/GLTexture.js b/packages/core/src/textures/GLTexture.js index 6fc4af0..056343e 100644 --- a/packages/core/src/textures/GLTexture.js +++ b/packages/core/src/textures/GLTexture.js @@ -1,10 +1,14 @@ +/** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ export default class GLTexture { constructor(texture) { /** * The WebGL texture - * * @member {WebGLTexture} */ this.texture = texture; diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index a0f55d7..95e1d85 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -108,7 +108,7 @@ * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} - * @private + * @protected */ this._uvs = DEFAULT_UVS; @@ -169,7 +169,7 @@ * Call updateUvs() to increment it. * * @member {number} - * @private + * @protected */ this._updateID = 0; @@ -196,7 +196,7 @@ /** * Called when the base texture is updated * - * @private + * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ onBaseTextureUpdated(baseTexture) @@ -333,7 +333,7 @@ * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|UintArray} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource @@ -579,6 +579,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); @@ -590,6 +591,7 @@ * * @static * @constant + * @member {PIXI.Texture} */ Texture.WHITE = createWhiteTexture(); removeAllHandlers(Texture.WHITE); diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index ade6b94..2af549d 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -38,8 +38,9 @@ this.uClampOffset = new Float32Array(2); /** - * @member {number} Tracks Texture frame changes - * @private + * Tracks Texture frame changes + * @member {number} + * @protected */ this._updateID = -1; diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 2bd7aa9..95cb141 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -33,7 +33,7 @@ /** * List of managed textures - * @member {PIXI.BaseTextures[]} + * @member {PIXI.BaseTexture[]} * @readonly */ this.managedTextures = []; @@ -41,8 +41,6 @@ /** * Sets up the renderer context and necessary buffers. - * - * @private */ contextChange() { diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 0eeba84..7ec353e 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -4,7 +4,7 @@ * A standard object to store the Uvs of a texture * * @class - * @private + * @protected * @memberof PIXI */ export default class TextureUvs @@ -32,7 +32,7 @@ /** * Sets the texture Uvs based on the given frame information. * - * @private + * @protected * @param {PIXI.Rectangle} frame - The frame of the texture * @param {PIXI.Rectangle} baseFrame - The base frame of the texture * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index 9c21902..f2b9039 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -156,7 +156,7 @@ /** * Load all the resources simultaneously * @override - * @return {Promise} When load is resolved + * @return {Promise} When load is resolved */ load() { @@ -188,7 +188,8 @@ * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer * @param {PIXI.BaseTexture} texture - * @param {PIXI.glCore.Texture} glTexture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded */ upload(renderer, texture, glTexture) { diff --git a/packages/core/src/textures/resources/BaseImageResource.js b/packages/core/src/textures/resources/BaseImageResource.js index fdf64ce..6c0b1d4 100644 --- a/packages/core/src/textures/resources/BaseImageResource.js +++ b/packages/core/src/textures/resources/BaseImageResource.js @@ -47,8 +47,9 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.glCore.GLTexture} glTexture Reference - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source (optional) + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture, source) { diff --git a/packages/core/src/textures/resources/BufferResource.js b/packages/core/src/textures/resources/BufferResource.js index 7ddfd9c..2f70059 100644 --- a/packages/core/src/textures/resources/BufferResource.js +++ b/packages/core/src/textures/resources/BufferResource.js @@ -1,6 +1,10 @@ import Resource from './Resource'; /** + * @interface SharedArrayBuffer + */ + +/** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource @@ -38,6 +42,8 @@ * Upload the texture to the GPU. * @param {PIXI.Renderer} renderer Upload to the renderer * @param {PIXI.BaseTexture} baseTexture Reference to parent texture + * @param {PIXI.GLTexture} glTexture glTexture + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 45b34f4..b8e082a 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -51,6 +51,7 @@ /** * Upload the resource + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/ImageResource.js b/packages/core/src/textures/resources/ImageResource.js index b3f58be..1bf548f 100644 --- a/packages/core/src/textures/resources/ImageResource.js +++ b/packages/core/src/textures/resources/ImageResource.js @@ -41,7 +41,7 @@ /** * When process is completed - * @member {Promise} + * @member {Promise} * @private */ this._process = null; @@ -77,7 +77,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -93,7 +93,7 @@ * returns a promise when image will be loaded and processed * * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} + * @returns {Promise} */ load(createBitmap) { @@ -151,7 +151,7 @@ * Called when we need to convert image into BitmapImage. * Can be called multiple times, real promise is cached inside. * - * @returns {Promise} cached promise to fill that bitmap + * @returns {Promise} cached promise to fill that bitmap */ process() { @@ -190,7 +190,8 @@ * * @param {PIXI.Renderer} renderer - Renderer to upload to * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.glCore.Texture} glTexture - GLTexture to use + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index ce84b39..292ea48 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -42,7 +42,7 @@ * and not cleaning up resources that were created * externally. * @member {boolean} - * @private + * @protected */ this.internal = false; @@ -50,6 +50,7 @@ * Mini-runner for handling resize events * * @member {Runner} + * @private */ this.onResize = new Runner('setRealSize', 2); @@ -57,6 +58,7 @@ * Mini-runner for handling update events * * @member {Runner} + * @private */ this.onUpdate = new Runner('update'); } @@ -128,7 +130,7 @@ * This can be overridden to start preloading a resource * or do any other prepare step. * @protected - * @return {Promise} Handle the validate event + * @return {Promise} Handle the validate event */ load() { @@ -162,7 +164,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars @@ -175,7 +177,7 @@ * * @param {PIXI.Renderer} renderer - yeah, renderer! * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.glCore.Texture} glTexture - texture instance for this webgl context + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context * @returns {boolean} `true` is success */ style(renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index 87c9874..d62ea63 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -4,7 +4,7 @@ /** * Resource type for SVG elements and graphics. * @class - * @extends PIXI.resources.TextureResource + * @extends PIXI.resources.BaseImageResource * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use @@ -42,7 +42,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ @@ -204,7 +204,8 @@ /** * Typedef for Size object. * - * @typedef {object} PIXI.resources.SVGResource~Size + * @memberof PIXI.resources.SVGResource + * @typedef {object} Size * @property {number} width - Width component * @property {number} height - Height component */ @@ -214,7 +215,7 @@ * * @method * @param {string} svgString - a serialized svg element - * @return {PIXI.resources.SVGResource~Size} image extension + * @return {PIXI.resources.SVGResource.Size} image extension */ static getSize(svgString) { @@ -260,10 +261,8 @@ * RegExp for SVG size. * * @static - * @constant - * @name SVG_SIZE + * @constant {RegExp|string} SVG_SIZE * @memberof PIXI.resources.SVGResource - * @type {RegExp|string} * @example <svg width="100" height="100"></svg> */ SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len diff --git a/packages/core/src/textures/resources/VideoResource.js b/packages/core/src/textures/resources/VideoResource.js index c48ac7e..6f869d2 100644 --- a/packages/core/src/textures/resources/VideoResource.js +++ b/packages/core/src/textures/resources/VideoResource.js @@ -72,7 +72,7 @@ /** * Promise when loading - * @member {Promise} + * @member {Promise} * @private * @default null */ diff --git a/packages/core/src/textures/resources/autoDetectResource.js b/packages/core/src/textures/resources/autoDetectResource.js index bb362c0..48fa8e0 100644 --- a/packages/core/src/textures/resources/autoDetectResource.js +++ b/packages/core/src/textures/resources/autoDetectResource.js @@ -11,6 +11,7 @@ * } * upload(renderer, baseTexture, glTexture) { * // upload with GL + * return true; * } * // used to auto-detect resource * static test(source, extension) { diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index db88a3a..1fa9d4d 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -153,7 +153,7 @@ /** * Adds sprite frame, transformed. * - * @param {PIXI.TransformBase} transform - TODO + * @param {PIXI.Transform} transform - TODO * @param {number} x0 - TODO * @param {number} y0 - TODO * @param {number} x1 - TODO @@ -243,7 +243,7 @@ /** * Add an array of mesh vertices * - * @param {PIXI.TransformBase} transform - mesh transform + * @param {PIXI.Transform} transform - mesh transform * @param {Float32Array} vertices - mesh coordinates in array * @param {number} beginOffset - begin offset * @param {number} endOffset - end offset, excluded diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 119eb35..89552a0 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -71,7 +71,7 @@ /** * Overridable method that can be used by Container subclasses whenever the children array is modified * - * @private + * @protected */ onChildrenChange() { @@ -452,6 +452,7 @@ * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * + * @protected */ _calculateBounds() { @@ -491,7 +492,7 @@ /** * Render the object using the WebGL renderer and advanced features. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ renderAdvanced(renderer) @@ -555,7 +556,7 @@ /** * To be overridden by the subclasses. * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) // eslint-disable-line no-unused-vars diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index 1d6d7d8..c3e4fb8 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -8,7 +8,7 @@ * This is an abstract class and should not be used on its own rather it should be extended. * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI */ export default class DisplayObject extends EventEmitter @@ -27,7 +27,7 @@ * World transform and local transform of this object. * This will become read-only later, please do not assign anything there unless you know what are you doing. * - * @member {PIXI.TransformBase} + * @member {PIXI.Transform} */ this.transform = new Transform(); @@ -79,8 +79,7 @@ * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. * * @member {number} - * @private - * @readOnly + * @protected */ this._lastSortedIndex = 0; @@ -89,7 +88,7 @@ * A higher value will mean it will be rendered on top of other displayObjects within the same container. * * @member {number} - * @private + * @protected */ this._zIndex = 0; @@ -117,7 +116,7 @@ * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Rectangle} - * @private + * @protected */ this._bounds = new Bounds(); this._boundsID = 0; @@ -129,7 +128,7 @@ * The original, cached mask of the object. * * @member {PIXI.Graphics|PIXI.Sprite} - * @private + * @protected */ this._mask = null; @@ -151,14 +150,19 @@ * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} - * @private - * @readonly + * @protected */ this._destroyed = false; + + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + this.isSprite = true; } /** - * @private + * @protected * @member {PIXI.DisplayObject} */ get _tempDisplayObjectParent() @@ -281,11 +285,11 @@ /** * Calculates the global position of the display object. * - * @param {PIXI.Point} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. + * @return {PIXI.IPoint} A point object representing the position of this object. */ toGlobal(position, point, skipUpdate = false) { @@ -315,12 +319,12 @@ /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.Point} position - The world origin to calculate from. + * @param {PIXI.IPoint} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object + * @return {PIXI.IPoint} A point object representing the position of this object */ toLocal(position, from, point, skipUpdate) { @@ -497,7 +501,7 @@ * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get position() { @@ -513,7 +517,7 @@ * The scale factor of the object. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get scale() { @@ -529,7 +533,7 @@ * The pivot point of the displayObject that it rotates around. * Assignment by value since pixi-v4. * - * @member {PIXI.Point|PIXI.ObservablePoint} + * @member {PIXI.IPoint} */ get pivot() { diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index cd3b3e8..4a4f87c 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -13,9 +13,9 @@ export default class BlurFilter extends Filter { /** - * @param {number} strength - The strength of the blur filter. - * @param {number} quality - The quality of the blur filter. - * @param {number} resolution - The resolution of the blur filter. + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution] - The resolution of the blur filter. * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. */ constructor(strength, quality, resolution, kernelSize) @@ -35,9 +35,9 @@ /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output, clear) { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index e32cb5f..b998d92 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -18,7 +18,7 @@ { /** * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} scale - The scale of the displacement + * @param {number} [scale] - The scale of the displacement */ constructor(sprite, scale) { @@ -40,15 +40,19 @@ scale = 20; } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ this.scale = new Point(scale, scale); } /** * Applies the filter. * - * @param {PIXI.FilterManager} filterManager - The manager. - * @param {PIXI.RenderTarget} input - The input target. - * @param {PIXI.RenderTarget} output - The output target. + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. */ apply(filterManager, input, output) { diff --git a/packages/filters/filter-noise/src/NoiseFilter.js b/packages/filters/filter-noise/src/NoiseFilter.js index 45f6f98..30facbe 100644 --- a/packages/filters/filter-noise/src/NoiseFilter.js +++ b/packages/filters/filter-noise/src/NoiseFilter.js @@ -17,8 +17,8 @@ export default class NoiseFilter extends Filter { /** - * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. */ constructor(noise = 0.5, seed = Math.random()) { diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 638276d..572b3e4 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -26,9 +26,7 @@ const temp = new Float32Array(3); -/** - * a default shader used by graphics.. - */ +// a default shader used by graphics.. let defaultShader = null; /** @@ -74,7 +72,7 @@ * If this Graphics object owns the GraphicsGeometry * * @member {boolean} - * @private + * @protected */ this._ownsGeometry = geometry === null; @@ -82,7 +80,7 @@ * Current fill style * * @member {PIXI.FillStyle} - * @private + * @protected */ this._fillStyle = new FillStyle(); @@ -90,7 +88,7 @@ * Current line style * * @member {PIXI.LineStyle} - * @private + * @protected */ this._lineStyle = new LineStyle(); @@ -98,7 +96,7 @@ * Current shape transform matrix. * * @member {PIXI.Matrix} - * @private + * @protected */ this._matrix = null; @@ -107,7 +105,7 @@ * * @member {boolean} * @default false - * @private + * @protected */ this._holeMode = false; @@ -115,7 +113,7 @@ * Current path * * @member {PIXI.Polygon} - * @private + * @protected */ this.currentPath = null; @@ -135,7 +133,7 @@ /** * A collections of batches! These can be drawn by the renderer batch system. * - * @private + * @protected * @member {object[]} */ this.batches = []; @@ -143,7 +141,7 @@ /** * Update dirty for limiting calculating tints for batches. * - * @private + * @protected * @member {number} * @default -1 */ @@ -152,7 +150,7 @@ /** * Copy of the object vertex data. * - * @private + * @protected * @member {Float32Array} */ this.vertexData = null; @@ -303,7 +301,7 @@ /** * Start a polygon object internally - * @private + * @protected */ startPoly() { @@ -329,7 +327,7 @@ /** * Finish the polygon object. - * @private + * @protected */ finishPoly() { @@ -394,7 +392,7 @@ /** * Initialize the curve * - * @private + * @protected * @param {number} [x=0] * @param {number} [y=0] */ @@ -794,7 +792,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -953,7 +951,7 @@ /** * Retrieves the bounds of the graphic shape as a rectangle object * - * @private + * @protected */ _calculateBounds() { @@ -978,7 +976,7 @@ /** * Recalcuate the tint by applying tin to batches using Graphics tint. - * @private + * @protected */ calculateTints() { @@ -1011,7 +1009,7 @@ /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. - * @private + * @protected */ calculateVertices() { diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 2aef678..1a71049 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -64,35 +64,35 @@ /** * An array of points to draw * @member {PIXI.Point[]} - * @private + * @protected */ this.points = []; /** * The collection of colors * @member {number[]} - * @private + * @protected */ this.colors = []; /** * The UVs collection * @member {number[]} - * @private + * @protected */ this.uvs = []; /** * The indices of the vertices * @member {number[]} - * @private + * @protected */ this.indices = []; /** * Reference to the texture IDs. * @member {number[]} - * @private + * @protected */ this.textureIds = []; @@ -100,7 +100,7 @@ * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsData = []; @@ -108,7 +108,7 @@ * Graphics data representing holes in the graphicsData. * * @member {PIXI.GraphicsData[]} - * @private + * @protected */ this.graphicsDataHoles = []; @@ -117,7 +117,7 @@ * object will be recalculated. * * @member {number} - * @private + * @protected */ this.dirty = 0; @@ -125,7 +125,7 @@ * Batches need to regenerated if the geometry is updated. * * @member {number} - * @private + * @protected */ this.batchDirty = -1; @@ -133,7 +133,7 @@ * Used to check if the cache is dirty. * * @member {number} - * @private + * @protected */ this.cacheDirty = -1; @@ -142,7 +142,7 @@ * * @member {number} * @default 0 - * @private + * @protected */ this.clearDirty = 0; @@ -150,7 +150,7 @@ * List of current draw calls drived from the batches. * * @member {object[]} - * @private + * @protected */ this.drawCalls = []; @@ -159,7 +159,7 @@ * Can be converted to drawCalls or to batchable objects. * * @member {object[]} - * @private + * @protected */ this.batches = []; @@ -167,7 +167,7 @@ * Index of the current last shape in the stack of calls. * * @member {number} - * @private + * @protected */ this.shapeIndex = 0; @@ -175,7 +175,7 @@ * Cached bounds. * * @member {PIXI.Bounds} - * @private + * @protected */ this._bounds = new Bounds(); @@ -183,7 +183,7 @@ * The bounds dirty flag. * * @member {number} - * @private + * @protected */ this.boundsDirty = -1; @@ -271,7 +271,7 @@ * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawShape(shape, fillStyle, lineStyle, matrix) { @@ -288,7 +288,7 @@ * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeomery} Returns geometry for chaining. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ drawHole(shape, matrix) { @@ -399,7 +399,7 @@ /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. - * @private + * @protected */ updateBatches() { @@ -552,7 +552,7 @@ /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. - * @private + * @protected */ isBatchable() { @@ -571,7 +571,7 @@ /** * Converts intermediate batches data to drawCalls. - * @private + * @protected */ buildDrawCalls() { @@ -703,7 +703,7 @@ * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render - * @private + * @protected */ proccessHoles(holes) { @@ -724,7 +724,7 @@ /** * Update the local bounds of the object. Expensive to use performance-wise. - * @private + * @protected */ calculateBounds() { @@ -853,7 +853,7 @@ /** * Transform points using matrix. * - * @private + * @protected * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ @@ -872,7 +872,7 @@ /** * Add colors. * - * @private + * @protected * @param {number[]} colors - List of colors to add to * @param {number} color - Color to add * @param {number} alpha - Alpha to use @@ -894,7 +894,7 @@ /** * Add texture id that the shader/fragment wants to use. * - * @private + * @protected * @param {number[]} textureIds * @param {number} id * @param {number} size @@ -910,7 +910,7 @@ /** * Generates the UVs for a shape. * - * @private + * @protected * @param {number[]} verts - Vertices * @param {number[]} uvs - UVs * @param {PIXI.Texture} texture - Reference to Texture @@ -950,7 +950,7 @@ * * @memberof PIXI.GraphicsGeometry * @static - * @member {number} + * @member {number} BATCHABLE_SIZE * @default 100 */ GraphicsGeometry.BATCHABLE_SIZE = 100; diff --git a/packages/graphics/src/utils/ArcUtils.js b/packages/graphics/src/utils/ArcUtils.js index 27bf365..384851c 100644 --- a/packages/graphics/src/utils/ArcUtils.js +++ b/packages/graphics/src/utils/ArcUtils.js @@ -13,6 +13,7 @@ * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * + * @private * @param {number} x1 - The x-coordinate of the beginning of the arc * @param {number} y1 - The y-coordinate of the beginning of the arc * @param {number} x2 - The x-coordinate of the end of the arc @@ -70,6 +71,7 @@ /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * + * @private * @param {number} startX - Start x location of arc * @param {number} startY - Start y location of arc * @param {number} cx - The x-coordinate of the center of the circle diff --git a/packages/graphics/src/utils/QuadraticUtils.js b/packages/graphics/src/utils/QuadraticUtils.js index 44ca29b..96229d4 100644 --- a/packages/graphics/src/utils/QuadraticUtils.js +++ b/packages/graphics/src/utils/QuadraticUtils.js @@ -51,6 +51,7 @@ * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c * + * @private * @param {number} cpX - Control point x * @param {number} cpY - Control point y * @param {number} toX - Destination point x diff --git a/packages/graphics/src/utils/Star.js b/packages/graphics/src/utils/Star.js index 5baf68a..09e26ec 100644 --- a/packages/graphics/src/utils/Star.js +++ b/packages/graphics/src/utils/Star.js @@ -5,6 +5,7 @@ * * @class * @extends PIXI.Polygon + * @memberof PIXI * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 36b060f..73f8b3c 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -32,7 +32,7 @@ * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction * * @class - * @extends EventEmitter + * @extends PIXI.utils.EventEmitter * @memberof PIXI.interaction */ export default class InteractionManager extends EventEmitter @@ -114,7 +114,7 @@ /** * The DOM element to bind to. * - * @private + * @protected * @member {HTMLElement} */ this.interactionDOMElement = null; @@ -135,7 +135,7 @@ /** * Have events been attached to the dom element? * - * @private + * @protected * @member {boolean} */ this.eventsAdded = false; @@ -143,7 +143,7 @@ /** * Is the mouse hovering over the renderer? * - * @private + * @protected * @member {boolean} */ this.mouseOverRenderer = false; @@ -214,7 +214,7 @@ * values, objects are handled as dictionaries of CSS values for interactionDOMElement, * and functions are called instead of changing the CSS. * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.)>} + * @member {Object.} */ this.cursorStyles = { default: 'inherit', @@ -982,7 +982,7 @@ * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * - * @private + * @protected * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject diff --git a/packages/interaction/src/InteractionTrackingData.js b/packages/interaction/src/InteractionTrackingData.js index 8493b63..694b220 100644 --- a/packages/interaction/src/InteractionTrackingData.js +++ b/packages/interaction/src/InteractionTrackingData.js @@ -9,6 +9,7 @@ { /** * @param {number} pointerId - Unique pointer id of the event + * @private */ constructor(pointerId) { @@ -38,6 +39,7 @@ * Unique pointer id of the event * * @readonly + * @private * @member {number} */ get pointerId() @@ -48,20 +50,15 @@ /** * State of the tracking data, expressed as bit flags * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get flags() { return this._flags; } - /** - * Set the flags for the tracking data - * - * @param {number} flags - Flags to set - */ - set flags(flags) + set flags(flags) // eslint-disable-line require-jsdoc { this._flags = flags; } @@ -69,8 +66,8 @@ /** * Is the tracked event inactive (not over or down)? * + * @private * @member {number} - * @memberof PIXI.interaction.InteractionTrackingData# */ get none() { @@ -80,20 +77,15 @@ /** * Is the tracked event over the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get over() { return (this._flags & this.constructor.FLAGS.OVER) !== 0; } - /** - * Set the over flag - * - * @param {boolean} yn - Is the event over? - */ - set over(yn) + set over(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.OVER, yn); } @@ -101,20 +93,15 @@ /** * Did the right mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get rightDown() { return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; } - /** - * Set the right down flag - * - * @param {boolean} yn - Is the right mouse button down? - */ - set rightDown(yn) + set rightDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); } @@ -122,20 +109,15 @@ /** * Did the left mouse button come down in the DisplayObject? * + * @private * @member {boolean} - * @memberof PIXI.interaction.InteractionTrackingData# */ get leftDown() { return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; } - /** - * Set the left down flag - * - * @param {boolean} yn - Is the left mouse button down? - */ - set leftDown(yn) + set leftDown(yn) // eslint-disable-line require-jsdoc { this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); } diff --git a/packages/interaction/src/interactiveTarget.js b/packages/interaction/src/interactiveTarget.js index cd8b8e7..6036664 100644 --- a/packages/interaction/src/interactiveTarget.js +++ b/packages/interaction/src/interactiveTarget.js @@ -4,6 +4,7 @@ * * @private * @name interactiveTarget + * @type {Object} * @memberof PIXI.interaction * @example * function MyObject() {} diff --git a/packages/loaders/src/AppLoaderPlugin.js b/packages/loaders/src/AppLoaderPlugin.js new file mode 100644 index 0000000..5ea8dee --- /dev/null +++ b/packages/loaders/src/AppLoaderPlugin.js @@ -0,0 +1,47 @@ +import Loader from './Loader'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ +export default class AppLoaderPlugin +{ + /** + * Called on application constructor + * @param {object} options + * @private + */ + static init(options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + } + + /** + * Called when application destroyed + * @private + */ + static destroy() + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + } +} diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index 98badbd..d2d59e4 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -51,7 +51,6 @@ * @see https://github.com/englercj/resource-loader * * @class Loader - * @extends module:resource-loader.ResourceLoader * @memberof PIXI * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. @@ -97,6 +96,7 @@ /** * Destroy the loader, removes references. + * @private */ destroy() { @@ -136,7 +136,7 @@ * Collection of all installed `use` middleware for Loader. * * @static - * @member {Array} + * @member {Array} _plugins * @memberof PIXI.Loader * @private */ @@ -149,7 +149,7 @@ * @static * @method registerPlugin * @memberof PIXI.Loader - * @param {PIXI.Loader~LoaderPlugin} plugin - The plugin to add + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ Loader.registerPlugin = function registerPlugin(plugin) @@ -172,16 +172,19 @@ /** * Plugin to be installed for handling specific Loader resources. - * @typedef {object} PIXI.Loader~LoaderPlugin - * @property {function} [plugin.add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader~loaderMiddleware} [plugin.pre] - Middleware function to run before load, the + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` - * @property {PIXI.Loader~loaderMiddleware} [plugin.use] - Middleware function to run after load, the + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ /** - * @callback PIXI.Loader~loaderMiddleware + * @memberof PIXI.Loader + * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/LoaderPlugin.js b/packages/loaders/src/LoaderPlugin.js deleted file mode 100644 index c586e58..0000000 --- a/packages/loaders/src/LoaderPlugin.js +++ /dev/null @@ -1,47 +0,0 @@ -import Loader from './Loader'; - -/** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {LoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(LoaderPlugin); - * @class - * @memberof PIXI - */ -export default class LoaderPlugin -{ - /** - * Called on application constructor - * @param {object} options - * @private - */ - static init(options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader.shared : new Loader(); - } - - /** - * Called when application destroyed - * @private - */ - static destroy() - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - } -} diff --git a/packages/loaders/src/TextureLoader.js b/packages/loaders/src/TextureLoader.js index 5094c8e..3b1d682 100644 --- a/packages/loaders/src/TextureLoader.js +++ b/packages/loaders/src/TextureLoader.js @@ -5,13 +5,13 @@ * Loader plugin for handling Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class TextureLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/loaders/src/index.js b/packages/loaders/src/index.js index 10aa771..278f871 100644 --- a/packages/loaders/src/index.js +++ b/packages/loaders/src/index.js @@ -9,4 +9,4 @@ export const LoaderResource = Resource; export { default as Loader } from './Loader'; export { default as TextureLoader } from './TextureLoader'; -export { default as LoaderPlugin } from './LoaderPlugin'; +export { default as AppLoaderPlugin } from './AppLoaderPlugin'; diff --git a/packages/loaders/test/AppLoaderPlugin.js b/packages/loaders/test/AppLoaderPlugin.js new file mode 100644 index 0000000..5492c78 --- /dev/null +++ b/packages/loaders/test/AppLoaderPlugin.js @@ -0,0 +1,33 @@ +const { AppLoaderPlugin, Loader } = require('../'); + +describe('PIXI.AppLoaderPlugin', function () +{ + it('should contain loader property', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); + + it('should use sharedLoader option', function () + { + const obj = {}; + + AppLoaderPlugin.init.call(obj, { sharedLoader: true }); + + expect(obj.loader).to.be.not.undefined; + expect(obj.loader).to.be.instanceof(Loader); + expect(obj.loader).to.equal(Loader.shared); + + AppLoaderPlugin.destroy.call(obj); + + expect(obj.loader).to.be.null; + }); +}); diff --git a/packages/loaders/test/LoaderPlugin.js b/packages/loaders/test/LoaderPlugin.js deleted file mode 100644 index 84ed306..0000000 --- a/packages/loaders/test/LoaderPlugin.js +++ /dev/null @@ -1,33 +0,0 @@ -const { LoaderPlugin, Loader } = require('../'); - -describe('PIXI.LoaderPlugin', function () -{ - it('should contain loader property', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); - - it('should use sharedLoader option', function () - { - const obj = {}; - - LoaderPlugin.init.call(obj, { sharedLoader: true }); - - expect(obj.loader).to.be.not.undefined; - expect(obj.loader).to.be.instanceof(Loader); - expect(obj.loader).to.equal(Loader.shared); - - LoaderPlugin.destroy.call(obj); - - expect(obj.loader).to.be.null; - }); -}); diff --git a/packages/loaders/test/index.js b/packages/loaders/test/index.js index 629fbb7..ab23037 100644 --- a/packages/loaders/test/index.js +++ b/packages/loaders/test/index.js @@ -1,3 +1,3 @@ require('./Loader'); require('./TextureLoader'); -require('./LoaderPlugin'); +require('./AppLoaderPlugin'); diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index a972d4a..9fd334b 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -482,6 +482,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get IDENTITY() { @@ -493,6 +494,7 @@ * * @static * @const + * @member {PIXI.Matrix} */ static get TEMP_MATRIX() { diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index fabd4a1..677fa2c 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -64,8 +64,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from. - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from. + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -82,8 +82,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -95,7 +95,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) @@ -141,3 +141,9 @@ } } } + +/** + * A number, or a string containing a number. + * @memberof PIXI + * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint + */ diff --git a/packages/math/src/Point.js b/packages/math/src/Point.js index e123f60..954a09e 100644 --- a/packages/math/src/Point.js +++ b/packages/math/src/Point.js @@ -39,8 +39,8 @@ /** * Copies x and y from the given point * - * @param {PIXI.Point} p - The point to copy from - * @returns Returns itself. + * @param {PIXI.IPoint} p - The point to copy from + * @returns {PIXI.IPoint} Returns itself. */ copyFrom(p) { @@ -52,8 +52,8 @@ /** * Copies x and y into the given point * - * @param {PIXI.Point} p - The point to copy. - * @returns Given point with values updated + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated */ copyTo(p) { @@ -65,7 +65,7 @@ /** * Returns true if the given point is equal to this point * - * @param {PIXI.Point} p - The point to check + * @param {PIXI.IPoint} p - The point to check * @returns {boolean} Whether the given point equal to this point */ equals(p) diff --git a/packages/math/src/const.js b/packages/math/src/const.js index 7d43a01..818fa94 100644 --- a/packages/math/src/const.js +++ b/packages/math/src/const.js @@ -2,9 +2,8 @@ * Two Pi. * * @static - * @constant + * @constant {number} PI_2 * @memberof PIXI - * @type {number} */ export const PI_2 = Math.PI * 2; @@ -12,9 +11,8 @@ * Conversion factor for converting radians to degrees. * * @static - * @constant + * @constant {number} RAD_TO_DEG * @memberof PIXI - * @type {number} */ export const RAD_TO_DEG = 180 / Math.PI; @@ -22,9 +20,8 @@ * Conversion factor for converting degrees to radians. * * @static - * @constant + * @constant {number} DEG_TO_RAD * @memberof PIXI - * @type {number} */ export const DEG_TO_RAD = Math.PI / 180; diff --git a/packages/math/src/shapes/Rectangle.js b/packages/math/src/shapes/Rectangle.js index 09beee5..3ff5c5e 100644 --- a/packages/math/src/shapes/Rectangle.js +++ b/packages/math/src/shapes/Rectangle.js @@ -97,6 +97,7 @@ * * @static * @constant + * @member {PIXI.Rectangle} */ static get EMPTY() { diff --git a/packages/mesh-extras/src/NineSlicePlane.js b/packages/mesh-extras/src/NineSlicePlane.js index e5adf73..d60d942 100644 --- a/packages/mesh-extras/src/NineSlicePlane.js +++ b/packages/mesh-extras/src/NineSlicePlane.js @@ -30,7 +30,7 @@ * * * @class - * @extends PIXI.Plane + * @extends PIXI.SimplePlane * @memberof PIXI * */ @@ -38,10 +38,10 @@ { /** * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {int} [leftWidth=10] size of the left vertical bar (A) - * @param {int} [topHeight=10] size of the top horizontal bar (C) - * @param {int} [rightWidth=10] size of the right vertical bar (B) - * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + * @param {number} [leftWidth=10] size of the left vertical bar (A) + * @param {number} [topHeight=10] size of the top horizontal bar (C) + * @param {number} [rightWidth=10] size of the right vertical bar (B) + * @param {number} [bottomHeight=10] size of the bottom horizontal bar (D) */ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) { @@ -54,7 +54,6 @@ * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._width = this._origWidth; @@ -63,7 +62,6 @@ * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} - * @memberof PIXI.NineSlicePlane# * @override */ this._height = this._origHeight; @@ -72,8 +70,7 @@ * The width of the left column (a) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; @@ -81,8 +78,7 @@ * The width of the right column (b) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; @@ -90,8 +86,7 @@ * The height of the top row (c) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; @@ -99,8 +94,7 @@ * The height of the bottom row (d) * * @member {number} - * @memberof PIXI.NineSlicePlane# - * @override + * @private */ this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index bab5ed2..4050c5b 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -29,6 +29,10 @@ super(ropeGeometry, meshMaterial); + /** + * re-calculate vertices by rope points each frame + * @member {boolean} + */ this.autoUpdate = true; } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 4695296..2eb570a 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -26,8 +26,9 @@ new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)); - /* - * @member {PIXI.Point[]} An array of points that determine the rope + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} */ this.points = points; diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 35667e2..80a8dd6 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -133,7 +133,8 @@ /** * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get uvBuffer() { @@ -143,7 +144,8 @@ /** * To change mesh vertices, change its uvBuffer data and increment its _updateID. * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @returns {PIXI.Buffer} + * @member {PIXI.Buffer} + * @readonly */ get verticesBuffer() { @@ -239,7 +241,7 @@ /** * Standard renderer draw. - * @private + * @protected */ _render(renderer) { @@ -260,7 +262,7 @@ /** * Standard non-batching way of rendering. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderDefault(renderer) @@ -295,7 +297,7 @@ /** * Rendering by using the Batch system. - * @private + * @protected * @param {PIXI.Renderer} renderer - Instance to renderer. */ _renderToBatch(renderer) @@ -396,7 +398,7 @@ * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * - * @private + * @protected */ _calculateBounds() { @@ -474,6 +476,6 @@ * of the geometry. * @memberof PIXI.Mesh * @static - * @member {number} + * @member {number} BATCHABLE_SIZE */ Mesh.BATCHABLE_SIZE = 100; diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index 69645f2..c102fd8 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -127,6 +127,7 @@ * Renders a cached version of the sprite with WebGL * * @private + * @function _renderCached * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -148,6 +149,7 @@ * Prepares the WebGL renderer to cache the sprite * * @private + * @function _initCachedDisplayObject * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -260,6 +262,7 @@ * Renders a cached version of the sprite with canvas * * @private + * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ @@ -281,6 +284,7 @@ * Prepares the Canvas renderer to cache the sprite * * @private + * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ diff --git a/packages/particles/src/ParticleBuffer.js b/packages/particles/src/ParticleBuffer.js index 97b2452..f3d2566 100644 --- a/packages/particles/src/ParticleBuffer.js +++ b/packages/particles/src/ParticleBuffer.js @@ -24,6 +24,7 @@ export default class ParticleBuffer { /** + * @private * @param {object} properties - The properties to upload. * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. * @param {number} size - The size of the batch. @@ -37,6 +38,7 @@ /** * The number of particles the buffer can hold * + * @private * @member {number} */ this.size = size; @@ -44,6 +46,7 @@ /** * A list of the properties that are dynamic. * + * @private * @member {object[]} */ this.dynamicProperties = []; @@ -51,6 +54,7 @@ /** * A list of the properties that are static. * + * @private * @member {object[]} */ this.staticProperties = []; @@ -109,6 +113,7 @@ * Holds the indices of the geometry (quads) to draw * * @member {Uint16Array} + * @private */ this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); geometry.addIndex(this.indexBuffer); @@ -184,6 +189,7 @@ /** * Uploads the dynamic properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -205,6 +211,7 @@ /** * Uploads the static properties. * + * @private * @param {PIXI.DisplayObject[]} children - The children to upload. * @param {number} startIndex - The index to start at. * @param {number} amount - The number to upload. @@ -226,6 +233,7 @@ /** * Destroys the ParticleBuffer. * + * @private */ destroy() { diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 9033751..43722ce 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -187,6 +187,7 @@ * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer * @return {PIXI.ParticleBuffer[]} The buffers + * @private */ generateBuffers(container) { diff --git a/packages/particles/src/ParticleShader.js b/packages/particles/src/ParticleShader.js deleted file mode 100644 index 069afe6..0000000 --- a/packages/particles/src/ParticleShader.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GLShader } from 'pixi-gl-core'; -import { PRECISION } from '@pixi/constants'; -import vertex from './particles.vert'; -import fragment from './particles.frag'; - -/** - * @class - * @extends PIXI.Shader - * @memberof PIXI - * @private - */ -export default class ParticleShader extends GLShader -{ - /** - * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. - */ - constructor(gl) - { - super(gl, vertex, fragment, PRECISION.DEFAULT); - } -} diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index e2be2fd..08c9d6c 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -240,7 +240,7 @@ * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerFindHook(addHook) { @@ -257,7 +257,7 @@ * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.BasePrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ registerUploadHook(uploadHook) { @@ -274,7 +274,7 @@ * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. */ add(item) { diff --git a/packages/prepare/src/CountLimiter.js b/packages/prepare/src/CountLimiter.js index 265c46c..a73ef14 100644 --- a/packages/prepare/src/CountLimiter.js +++ b/packages/prepare/src/CountLimiter.js @@ -3,7 +3,7 @@ * number of items per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class CountLimiter { @@ -14,6 +14,7 @@ { /** * The maximum number of items that can be prepared each frame. + * @type {number} * @private */ this.maxItemsPerFrame = maxItemsPerFrame; diff --git a/packages/prepare/src/TimeLimiter.js b/packages/prepare/src/TimeLimiter.js index 5f40686..89d7b04 100644 --- a/packages/prepare/src/TimeLimiter.js +++ b/packages/prepare/src/TimeLimiter.js @@ -3,7 +3,7 @@ * number of milliseconds per frame. * * @class - * @memberof PIXI + * @memberof PIXI.prepare */ export default class TimeLimiter { @@ -14,6 +14,7 @@ { /** * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} * @private */ this.maxMilliseconds = maxMilliseconds; diff --git a/packages/settings/src/utils/canUploadSameBuffer.js b/packages/settings/src/utils/canUploadSameBuffer.js index a02f0ae..22cc403 100644 --- a/packages/settings/src/utils/canUploadSameBuffer.js +++ b/packages/settings/src/utils/canUploadSameBuffer.js @@ -5,6 +5,7 @@ * Apparent on iOS so only check for that at the moment * This check may become more complex if this issue pops up elsewhere. * + * @private * @returns {boolean} */ export default function canUploadSameBuffer() diff --git a/packages/settings/src/utils/maxRecommendedTextures.js b/packages/settings/src/utils/maxRecommendedTextures.js index 679881f..91d505a 100644 --- a/packages/settings/src/utils/maxRecommendedTextures.js +++ b/packages/settings/src/utils/maxRecommendedTextures.js @@ -9,6 +9,7 @@ * In v4, all mobile devices were limited to 4 texture units because for this. * In v5, we allow all texture units to be used on modern Apple or Android devices. * + * @private * @param {number} max * @returns {number} */ diff --git a/packages/sprite-animated/src/AnimatedSprite.js b/packages/sprite-animated/src/AnimatedSprite.js index b4a738b..e7ea9b1 100644 --- a/packages/sprite-animated/src/AnimatedSprite.js +++ b/packages/sprite-animated/src/AnimatedSprite.js @@ -3,13 +3,6 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker'; /** - * @typedef PIXI.extras.AnimatedSprite~FrameObject - * @type {object} - * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame - * @property {number} time - the duration of the frame in ms - */ - -/** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * * ```js @@ -22,7 +15,7 @@ * textureArray.push(texture); * }; * - * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); * ``` * * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} @@ -33,7 +26,7 @@ * * function setup() { * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); * ... * } * ``` @@ -45,7 +38,7 @@ export default class AnimatedSprite extends Sprite { /** - * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame * objects that make up the animation. * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. */ @@ -54,11 +47,13 @@ super(textures[0] instanceof Texture ? textures[0] : textures[0].texture); /** + * @type {PIXI.Texture[]} * @private */ this._textures = null; /** + * @type {number[]} * @private */ this._durations = null; @@ -413,3 +408,11 @@ return currentFrame; } } + +/** + * @memberof PIXI.AnimatedSprite + * @typedef {object} FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ diff --git a/packages/sprite-tiling/src/TilingSprite.js b/packages/sprite-tiling/src/TilingSprite.js index 77a6491..8bde45e 100644 --- a/packages/sprite-tiling/src/TilingSprite.js +++ b/packages/sprite-tiling/src/TilingSprite.js @@ -143,7 +143,7 @@ /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ _render(renderer) @@ -166,7 +166,7 @@ /** * Updates the bounds of the tiling sprite. * - * @private + * @protected */ _calculateBounds() { @@ -260,10 +260,10 @@ * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite - * @return {PIXI.Texture} The newly created texture + * @return {PIXI.TilingSprite} The newly created texture */ static from(source, width, height) { diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index eb72d82..981683e 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -165,6 +165,7 @@ /** * used to fast check if a sprite is.. a sprite! + * @member {boolean} */ this.isSprite = true; @@ -350,7 +351,7 @@ * * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ _render(renderer) @@ -364,7 +365,7 @@ /** * Updates the bounds of the sprite. * - * @private + * @protected */ _calculateBounds() { diff --git a/packages/spritesheet/src/Spritesheet.js b/packages/spritesheet/src/Spritesheet.js index 28597d7..7c83c8b 100644 --- a/packages/spritesheet/src/Spritesheet.js +++ b/packages/spritesheet/src/Spritesheet.js @@ -66,9 +66,9 @@ /** * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: * ```js - * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) * ``` * @member {Object} */ diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index c9c539b..9c016be 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -9,13 +9,13 @@ * Texture resources. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class SpritesheetLoader { /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapFontLoader.js b/packages/text-bitmap/src/BitmapFontLoader.js index 2536cf5..7234d86 100644 --- a/packages/text-bitmap/src/BitmapFontLoader.js +++ b/packages/text-bitmap/src/BitmapFontLoader.js @@ -6,7 +6,7 @@ * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. * @class * @memberof PIXI - * @extends PIXI.Loader~LoaderPlugin + * @implements PIXI.ILoaderPlugin */ export default class BitmapFontLoader { @@ -58,7 +58,7 @@ /** * Called after a resource is loaded. - * @see PIXI.Loader~loaderMiddleware + * @see PIXI.Loader.loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 9c08e7b..8a3efcf 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -422,7 +422,7 @@ /** * The font descriptor of the BitmapText object. * - * @member {string|object} + * @member {object} */ get font() { diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d142e09..2dad3b3 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -398,6 +398,7 @@ /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected */ _calculateBounds() { diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 222063e..3a47899 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -7,7 +7,7 @@ * ``` * * @class - * @memberOf PIXI + * @memberof PIXI */ export default class TextMetrics { @@ -16,8 +16,8 @@ * @param {PIXI.TextStyle} style - the style that was measured * @param {number} width - the measured width of the text * @param {number} height - the measured height of the text - * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` * @param {number} lineHeight - the measured line height for this style * @param {number} maxLineWidth - the maximum line width for all measured lines * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont @@ -426,7 +426,7 @@ * * @private * @param {string} text The text - * @return {array} A tokenized array + * @return {string[]} A tokenized array */ static tokenize(text) { @@ -507,7 +507,7 @@ * * @static * @param {string} font - String representing the style of the font - * @return {PIXI.TextMetrics~FontMetrics} Font properties object + * @return {PIXI.TextMetrics.FontMetrics} Font properties object */ static measureFont(font) { @@ -629,7 +629,7 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @class FontMetrics - * @memberof PIXI.TextMetrics~ + * @memberof PIXI.TextMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent @@ -656,7 +656,7 @@ TextMetrics._context = canvas.getContext('2d'); /** - * Cache of PIXI.TextMetrics~FontMetrics objects. + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @memberof PIXI.TextMetrics * @type {Object} * @private diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 4bb6d7a..ed8904a 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -28,6 +28,7 @@ /** * Internal current frame request ID + * @type {?number} * @private */ this._requestId = null; @@ -35,6 +36,7 @@ /** * Internal value managed by minFPS property setter and getter. * This is the maximum allowed milliseconds between updates. + * @type {number} * @private */ this._maxElapsedMS = 100; diff --git a/packages/ticker/src/TickerListener.js b/packages/ticker/src/TickerListener.js index 2874b81..2bdb362 100644 --- a/packages/ticker/src/TickerListener.js +++ b/packages/ticker/src/TickerListener.js @@ -9,7 +9,7 @@ { /** * Constructor - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} [context=null] - The listener context * @param {number} [priority=0] - The priority for emitting @@ -19,36 +19,42 @@ { /** * The handler function to execute. + * @private * @member {Function} */ this.fn = fn; /** * The calling to execute. + * @private * @member {Function} */ this.context = context; /** * The current priority. + * @private * @member {number} */ this.priority = priority; /** * If this should only execute once. + * @private * @member {boolean} */ this.once = once; /** * The next item in chain. + * @private * @member {TickerListener} */ this.next = null; /** * The previous item in chain. + * @private * @member {TickerListener} */ this.previous = null; @@ -63,7 +69,7 @@ /** * Simple compare function to figure out if a function and context match. - * + * @private * @param {Function} fn - The listener function to be added for one update * @param {Function} context - The listener context * @return {boolean} `true` if the listener match the arguments @@ -77,6 +83,7 @@ /** * Emit by calling the current function. + * @private * @param {number} deltaTime - time since the last emit. * @return {TickerListener} Next ticker */ @@ -113,6 +120,7 @@ /** * Connect to the list. + * @private * @param {TickerListener} previous - Input node, previous listener */ connect(previous) @@ -128,6 +136,7 @@ /** * Destroy and don't use after this. + * @private * @param {boolean} [hard = false] `true` to remove the `next` reference, this * is considered a hard destroy. Soft destroy maintains the next reference. * @return {TickerListener} The listener to redirect while emitting or removing. diff --git a/packages/utils/src/const.js b/packages/utils/src/const.js index cf431a8..5895fe1 100644 --- a/packages/utils/src/const.js +++ b/packages/utils/src/const.js @@ -3,10 +3,8 @@ * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static - * @constant - * @name DATA_URI + * @constant {RegExp|string} DATA_URI * @memberof PIXI - * @type {RegExp|string} * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; diff --git a/packages/utils/src/media/caches.js b/packages/utils/src/media/caches.js index 7ef46ae..6185065 100644 --- a/packages/utils/src/media/caches.js +++ b/packages/utils/src/media/caches.js @@ -1,24 +1,30 @@ /** * @todo Describe property usage * + * @static + * @name ProgramCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const ProgramCache = {}; /** * @todo Describe property usage * + * @static + * @name TextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const TextureCache = Object.create(null); /** * @todo Describe property usage * + * @static + * @name BaseTextureCache * @memberof PIXI.utils - * @private + * @type {Object} */ export const BaseTextureCache = Object.create(null); diff --git a/packages/utils/src/media/trimCanvas.js b/packages/utils/src/media/trimCanvas.js index 1fddcf6..5549664 100644 --- a/packages/utils/src/media/trimCanvas.js +++ b/packages/utils/src/media/trimCanvas.js @@ -1,9 +1,8 @@ /** * Trim transparent borders from a canvas * - * @memberof PIXI + * @memberof PIXI.utils * @function trimCanvas - * @private * @param {HTMLCanvasElement} canvas - the canvas to trim * @returns {object} Trim data */ diff --git a/packages/utils/src/network/decomposeDataUri.js b/packages/utils/src/network/decomposeDataUri.js index 8572ee8..1f022aa 100644 --- a/packages/utils/src/network/decomposeDataUri.js +++ b/packages/utils/src/network/decomposeDataUri.js @@ -3,11 +3,12 @@ /** * Typedef for decomposeDataUri return object. * - * @typedef {object} PIXI.utils~DecomposedDataUri - * @property {mediaType} Media type, eg. `image` - * @property {subType} Sub type, eg. `png` - * @property {encoding} Data encoding, eg. `base64` - * @property {data} The actual data + * @memberof PIXI.utils + * @typedef {object} DecomposedDataUri + * @property {string} mediaType Media type, eg. `image` + * @property {string} subType Sub type, eg. `png` + * @property {string} encoding Data encoding, eg. `base64` + * @property {string} data The actual data */ /** @@ -17,7 +18,7 @@ * @memberof PIXI.utils * @function decomposeDataUri * @param {string} dataUri - the data URI to check - * @return {PIXI.utils~DecomposedDataUri|undefined} The decomposed data uri or undefined + * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined */ export function decomposeDataUri(dataUri) {